<template>
  <a-card>
    <a-tabs defaultActiveKey='1'>
      <a-tab-pane key='1' tab='生成条码'>
        <OutboundCodeList ref='outboundCodeListRef'>
          <template #action>
            <a-space align='center'>
              <a-button v-if='!isEdit' icon='edit' @click='handleEdit()'>
                编辑数量
              </a-button>
              <a-button
                v-else
                :style="{ backgroundColor: '#2ed573', borderColor: '#2ed573' }"
                icon='save'
                type='primary'
                @click='handleSave()'
              >
                保存
              </a-button>
              <a-button type='primary' @click="handleGenerate('100x80')">
                生成标签(100x80)
              </a-button>
              <a-button type='primary' @click="handleGenerate('2x2')">
                生成标签(2x2)
              </a-button>
              <a-button type='primary' @click="handleGenerate('2x3')">
                生成标签(2x3)
              </a-button>
              <a-button icon='reset' type='primary' @click='handleReset()'>
                重置
              </a-button>
            </a-space>
          </template>
        </OutboundCodeList>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>
import OutboundCodeList from '@views/code/OutboundCodeList.vue'

export default {
  name: 'OutboundCodePrint',
  components: {
    OutboundCodeList
  },
  data() {
    return {
      loading: false,
      isEdit: false,
      dataUrl: '/sale/hfSalePrice/codePrintList'
    }
  },
  watch: {},
  methods: {
    handleEdit() {
      this.isEdit = this.$refs.outboundCodeListRef.edit()
    },
    handleSave() {
      this.isEdit = this.$refs.outboundCodeListRef.save()
    },
    handleReset() {
      this.isEdit = false
      this.$refs.outboundCodeListRef.handleReset()
    },
    handleGenerate(type) {
      this.$refs.outboundCodeListRef.handleGenerate(type)
    }
  }
}
</script>
<style scoped></style>
